package com.itheima;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class Demo2 {
    public static void main(String[] args) throws ParseException {
        String s = "2008-08-08 08:08:08";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = simpleDateFormat.parse(s);
        System.out.println(date);


        String str = "2008-08-08 08:08:08";
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime parse = LocalDateTime.parse(str,dateTimeFormatter);
        System.out.println(parse);

    }
}
